package com.etc.service.impl;

import java.util.List;

import com.etc.dao.impl.AnnouncementDaoImpl;
import com.etc.entity.Announcement;
import com.etc.service.AnnouncementService;
import com.etc.util.PageData;

public class AnnouncementServiceImpl implements AnnouncementService{
	AnnouncementDaoImpl dao = new AnnouncementDaoImpl();

	@Override
	public List<Announcement> queryAllAnnouncement() {
		
		//调用dao层
		List<Announcement> list = dao.queryAllAnnouncement();
		return list;
	}

	@Override
	public boolean addAnnouncement(Announcement announcement) {
		if (announcement!=null) {
			//不为空才可以添加
				return dao.addAnnouncement(announcement);
			}
		return false;
	}

	@Override
	public boolean rmvAnnouncement(int id) {
		boolean b = dao.rmvAnnouncement(id);
		return b;
	}

	@Override
	public List<Announcement> queryNewAnnouncement() {
		
		return dao.queryNewAnnouncement();
	}

	/**
	 * 分页
	 */
	@Override
	public PageData queryAnnByLikeAndLimit(int pageNo, int pageSize, String alike) {
		// TODO Auto-generated method stub
		return dao.queryAnnByLikeAndLimit(pageNo, pageSize, alike);
	}

	@Override
	public Announcement queryAnnById(int id) {
		// TODO Auto-generated method stub
		return dao.queryAnnById(id);
	}

	@Override
	public List<Announcement> queryByTitleLike(String title) {
		// TODO Auto-generated method stub
		return dao.queryByTitleLike(title);
	}

}
